<?php


function new_excerpt_length($length) {
   return 150;
}
add_filter("excerpt_length", "new_excerpt_length");


function get_first_image($post) {
    $first_img = '';
    $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
    $first_img = $matches [1] [0];
    if(empty($first_img)){
        //Defines a default image
        $first_img = "";
    }
    return $first_img;
}

?>